<div class="top">
    <div class="logo">数媒贴吧</div>
    <?php if (isset($_SESSION['user_id']) && isset($_SESSION['username'])):?>
        <div class="login-info">
            <span>登录用户名：<?php echo $_SESSION['username'];?></span>
            <a href="/index.php?c=post&a=add">发布帖子</a> |
            <a href="/index.php?c=user&a=logout">安全退出</a>
        </div>
    <?php else:?>
        <div class="login-info">
            <a href="/index.php?c=user&a=login">登录</a> |
            <a href="/index.php?c=user&a=register">注册</a>
        </div>
    <?php endif;?>
</div>
<div class="nav">
    <ul>
        <li><a href="/">首页</a></li>
        <?php foreach($navList as $val):?>
        <li><a href="/index.php?cate_id=<?php echo $val['id'];?>"><?php echo $val['title'];?></a></li>
        <?php endforeach;?>
    </ul>
</div>